﻿@model PortalWeb.Areas.Admin.Models.ManageLoginsViewModel
@using Microsoft.Owin.Security
@{
    ViewBag.Title = "管理你的外部登录名";
}
<div class="header">
    <h1>@ViewBag.Title</h1>
</div>
<ul class="breadcrumb">
    <li>@Html.ActionLink("Home", "Index", "Home")</li>
    <li>@Html.ActionLink("更改你的帐户设置", "Index", "Manage")</li>
    <li class="active">管理你的外部登录名</li>
</ul>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="well">

            <p class="text-success">@ViewBag.StatusMessage</p>
            @if (Model.CurrentLogins.Count() == 0)
            {
                <div>
                    <p>
                        没有配置外部身份验证服务。有关设置此 ASP.NET 应用程序
                        以支持通过外部服务登录的详细信息，请参阅<a href="http://go.microsoft.com/fwlink/?LinkId=313242">此文</a>。
                    </p>
                </div>
            }
            @if (Model.CurrentLogins.Count > 0)
            {
                <h4>已注册的登录名</h4>
                <table class="table">
                    <tbody>
                    @foreach (var account in Model.CurrentLogins)
                    {
                        <tr>
                            <td>@account.LoginProvider</td>
                            <td>
                                @if (ViewBag.ShowRemoveButton)
                                {
                                    using (Html.BeginForm("RemoveLogin", "Manage"))
                                    {
                                        @Html.AntiForgeryToken()
                                        <div>
                                            @Html.Hidden("loginProvider", account.LoginProvider)
                                            @Html.Hidden("providerKey", account.ProviderKey)
                                            <input type="submit" class="btn btn-default" value="删除" title="从你的帐户中删除此 @account.LoginProvider 登录"/>
                                        </div>
                                    }
                                }
                                else
                                {
                                    @: &nbsp;
                                }
                            </td>
                        </tr>
                    }
                    </tbody>
                </table>
            }
            @if (Model.OtherLogins.Count > 0)
            {
                <h4>添加另一个用于登录的服务。</h4>
                <hr/>
                using (Html.BeginForm("LinkLogin", "Manage"))
                {
                    @Html.AntiForgeryToken()
                    <div id="socialLoginList">
                        <p>
                            @foreach (AuthenticationDescription p in Model.OtherLogins)
                            {
                                <button type="submit" class="btn btn-default" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="使用你的 @p.Caption 帐户登录">@p.AuthenticationType</button>
                            }
                        </p>
                    </div>
                }
            }
        </div>
    </div>
</div>
